package zhtt02.action08_parentPackage;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhtt on 2017/4/19.
 */
@ParentPackage(value="struts-default")
public class Demo02Action extends ActionSupport {

    private Map<String,String> user=new HashMap<String, String>();

    @Action(value="getUser",results={@Result(name="success",type="json",params={"contentType","text/html","root","user"})})
    public String execute() throws Exception {
        user.put("name","张三");
        user.put("age","32");
        return SUCCESS;
    }

    public Map<String, String> getUser() {
        return user;
    }

    public void setUser(Map<String, String> user) {
        this.user = user;
    }
}
